//
//  FileSocket.h
//  TcpTest_Client
//
//  Created by scarlettsun on 12-8-3.
//  Copyright (c) 2012年 tencent. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "GCDAsyncSocket.h"
#import "FileTransferDelegate.h"

#ifndef LENGTH
#define LENGTH  sizeof(NSUInteger)
#endif 


#ifndef CLIENT_LISTEN_PORT
#define CLIENT_LISTEN_PORT  9533
#endif


enum ReadMode {Readlenth = 0, ReadContent =1 };  //按照固定长度或者包长度读取

/*
  文件传输socket 的封装
 */

@interface FileSocket : NSObject<GCDAsyncSocketDelegate>
{
    /*read state，Readlenth---read length ReadContent--- read content；*/
    enum ReadMode readMode; 
    
    /*data lenth;*/
    NSUInteger packetLength; 
    
    /*data buffer;*/
    NSMutableData *buffer; 
    
}
@property id<FileTransferDelegate> delegate;
@property GCDAsyncSocket * fileAsynSocket;      //tcp socket
/**/
-(FileSocket *) initWithSock:(GCDAsyncSocket *)sock;



@end




